<%@ page contentType="text/html; charset=UTF-8" language="java"%>
<%@ page import="com.hzqy.commons.utils.ConstantUtils" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>标签修改</title>
<link rel="stylesheet" type="text/css"
	href="../static/js/themes/public.css">
<link rel="stylesheet" type="text/css"
	href="../static/js/themes/ddspstyle.css">
<link rel="stylesheet" type="text/css"
	href="../static/js/themes/default/easyui.css">
<link rel="stylesheet" type="text/css"
	href="../static/js/themes/icon.css">
<script type="text/javascript" src="../static/js/jquery.min.js"></script>
<script type="text/javascript" src="../static/js/jquery.easyui.min.js"></script>
<script type="text/javascript"
	src="../static/js/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="../static/js/jquery.validate.js"></script>
<script type="text/javascript" src="../static/js/index.js"></script>
	<script type="text/javascript" charset="utf-8" src="../static/js/Base64.js"></script>
	<script type="text/javascript" charset="utf-8" src="../static/js/beforeData.js"></script>
</head>
<%
String para =request.getParameter("parentid");
int f_label_id = 0;
if(para != null)
	f_label_id = Integer.valueOf(para);
String []nonceObj=ConstantUtils.getNonceObject();
%>
<body>
<div id="right" style="width: 100%; overflow: auto; float: right">
		<div id="container">
			<div class="editspace">
				<form id="contentForm" class="cmxform" enctype="multipart/form-data"
					name="formName">
					<input type="hidden" name="stime" value="<%=nonceObj[0]%>"/>
					<input type="hidden" name="sign" value="<%=nonceObj[1]%>"/>
					
					<input type="hidden" id="f_label_id" name="f_label_id" value="" />
					<input type="hidden" id="f_label_parentid" name="f_label_parentid" value="" /> 
					<legend>标签修改</legend>
					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="30%" align="right">
										<span class="red">
											*
										</span>
										标签名称：
									</td>
									<td width="70%">
										<input type="text" name="f_label_name" id="f_label_name" style="width: 150px;" value=""/> 
									</td>
								</tr>
							</table>
						</div>
					</fieldset>

					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="30%" align="right">
										<span class="red">
											*
										</span>
										标签状态：
									</td>
									<td width="70%">
										<select name="f_label_status" id="f_label_status" style="width: 150px;">
												<option value="1">有效</option>
												<option value="2">无效</option>
										</select>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>

					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="30%" align="right">
										标签描述：
									</td>
									<td width="70%">
										<textarea cols="20" rows="4" style="resize:none; width:150px;" id="f_label_desc" name="f_label_desc">
										</textarea>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
				</form>
			</div>
			<div class="toolbar" style="text-align: center;">
				<a id="easyui-linkbutton" class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0);" onclick="_submitFm()">
					保存
				</a> 
				<a href="javascript:void(0);" data-options="iconCls:'icon-cancel'" class="easyui-linkbutton" onclick="javascript:parent.$('#dlg').dialog('close')">
					取消
				</a>
			</div>
		</div>
	</div> 
</body>
<script type="text/javascript">
$(function(){
	$("#contentForm").validate({
		rules: {
			f_label_name: {
				required: true,
				minlength: 1,
				maxlength: 50
			},
		},
		messages: {
			f_label_name: {
				required: "请输入标签名称",
				minlength: "标签名称不能少于1位",
				maxlength: "标签名称不能超过50位"
			},
		},
		
	});
});
window.onload=function(){
	$.ajax({
		url:"select_label.do?f_label_id=<%=f_label_id %>",
		success:function(data){
			data=JSON.parse(data);
			$("#f_label_id").val(data.f_label_id);
			$("#f_label_parentid").val(data.f_label_parentid);
			$("#f_label_name").val(data.f_label_name);
			$("#f_label_desc").val(data.f_label_desc);
			$("#f_label_status").val(data.f_label_status);
			beforeData(data, <%=f_label_id %>, "", "../beforeData.do");
		}
	});
}
function _submitFm() {
	 if($("#contentForm").validate().form()) {
		app_ajax('update_label.do', $("#contentForm").serialize(), function(data){
			if(data.success) {
				$.messager.progress('close');
				$.messager.alert('提示', '提交成功！', 'info', function() {
					//parent.$('#dlg').dialog('close');
					//parent.gotoSearch($('#easyui-treegrid'));
					window.location.reload();
				});
			} else {
				$.messager.alert('提示', data.result, 'info', function() {
					$.messager.progress('close');
				});
			}
		});	
	 }
	 window.parent.leftFrame.location.href = "label_list.jsp";
}
</script>
</html>